$(function () {
    judgeUsernameLogin();
});

function judgeUsernameLogin() {
    let data = myAjax('/back/common', 'get', {});
    console.log(data);
    if (data.result == -1) {
        window.location.href = "/html/login.html";
    }

}

function myAjax(url, type, data) {
    let resutl = null;
    $.ajax({
        url: url,
        type: type,
        data: data,
        async: false,
        dataType: 'json',
        success: function (data) {
            resutl = data;
        }
    });
    return resutl;
}

function imgMyAjax() {
    let resutl = null;
    $.ajax({
        url: url,
        type: type,
        data: data,
        async: false,
        dataType: 'json',
        processData: false,
        contentType: false,
        success: function (data) {//data后台传递到前台的数据
            resutl = data;
        }
    });
    return resutl;
}